package com.jyserver.common.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

@ApiModel(value = "返回参数集合", description = "多条记录")
public class ResultList<T> {
    @ApiModelProperty(value = "请求结果",example="100")
    private int code = 100;

    @ApiModelProperty(value = "描述")
    private String msg = "请求成功";

    @ApiModelProperty(value = "数据集")
    private List<T> lists;

    @ApiModelProperty(value = "操作处理是否成功")
    private boolean succeed = true;

    @ApiModelProperty(value = "总页数")
    private int pages = 1;

    @ApiModelProperty(value = "当前页数")
    private int pagesIndex = 1;


    @ApiModelProperty(value = "页面记录大小")
    private int pagesSize = 1;

    @ApiModelProperty(value = "总数据记录")
    private int total = 1;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public boolean isSucceed() {
        return succeed;
    }

    public void setSucceed(boolean succeed) {
        this.succeed = succeed;
    }

    public int getPages() {
        return pages;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public int getPagesIndex() {
        return pagesIndex;
    }

    public void setPagesIndex(int pagesIndex) {
        this.pagesIndex = pagesIndex;
    }

    public int getPagesSize() {
        return pagesSize;
    }

    public void setPagesSize(int pagesSize) {
        this.pagesSize = pagesSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<T> getLists() {
        return lists;
    }

    public void setLists(List<T> lists) {
        this.lists = lists;
    }

    public ResultList(int code, String msg, List<T> lists) {
        this.code = code;
        this.msg = msg;
        this.lists = lists;
    }

    public ResultList(int code, String msg) {
        this.code = code;
        this.msg = msg;
        this.lists = null;
    }

    public ResultList(String msg, List<T> lists) {
        this.msg = msg;
        this.lists = lists;
    }

    public ResultList(String msg, List<T> lists, int pages, int pagesIndex, int total, int pagesSize) {
        this.msg = msg;
        this.pages = pages;
        this.pagesIndex = pagesIndex;
        this.total = total;
        this.lists = lists;
        this.pagesSize = pagesSize;
    }

    public ResultList(String msg, boolean succeed) {
        this.msg = msg;
        this.succeed = succeed;
    }

    public ResultList(List<T> lists) {
        this.lists = lists;
    }
}
